﻿<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="ScriptThisPortal.ascx.cs"
    Inherits="Micronet.OpenWeb.Com.ControlLib.ScriptThisPortal" %>
<owc:OwScriptBlock ID="OwSb" runat="server">
    <script type="text/javascript" src="/App_Common/Resources/Scripts/ThisPortal.js">
    </script>
    <script src="/App_Common/Resources/Scripts/organictabs.jquery.js" type="text/javascript"></script>
    <script src="/App_Common/Resources/Scripts/AutoShowHide.js" type="text/javascript"></script>
    <script type="text/javascript" src="http://cdn.openweb.vn/Resources/scripts/jquery.js"></script>
    <script type="text/javascript" src="http://cdn.openweb.vn/Resources/scripts/jquery.timeago.js"></script>
    <script type="text/javascript" src="/App_Common/Resources/Scripts/InstantMessage.js"></script>
    <script type="text/javascript">

        //instant message
        $(function ()
            {
                <% if (Membership.GetUser()!=null)
                {
                %>
                $('#OpenWebChat').OpenWebChat('<%= Membership.GetUser().ProviderUserKey.ToString().Replace("-","") %>');
                <%
                } %>                        
            });     
        //end instant message
        function OwSetVisible(id) {
            $(id).show();
        }
        function OwSetInVisible(id) {
            $(id).hide();
        }
        $(document).ready(function () {
           // $("#NewsHotHomePageDiv > ul").tabs({ fx: { opacity: "toggle"} }).tabs("rotate", 5000, true);
            $(".TopNewsItem").hover(function () {
                $(".NewsUlHover").hide();
                $(this).find(".NewsUlHover").show();
            });
            //Image Home
            $('.ImageHomePageItemWrapper').live({ hover: function () {
                $(this).stop().find(".ImageCaption").slideDown('fast');
            }, mouseout: function () {
                $(".ImageCaption").stop().slideUp('fast');
            }
            });
        });
        Sys.Application.add_load(initSomething);
        function initSomething() {
            if ($('a.lightbox').lengh > 0) {
                $('a.lightbox').lightBox();
            }
        }
        //Font resize
        var min = 8;
        var max = 18;
        var s;
        function increaseFontSize() {
            var p = document.getElementsByTagName('span');
            for (var i = 0; i < p.length; i++) {
                if (p[i].style.fontSize) {
                    s = parseInt(p[i].style.fontSize.replace("px", ""));
                } else {
                    s = 12;
                }
                if (s != max) {
                    s += 1;
                }
                p[i].style.fontSize = s + "px";
            }
        }
        function decreaseFontSize() {
            var p = document.getElementsByTagName('span');
            var s;
            for (var i = 0; i < p.length; i++) {
                if (p[i].style.fontSize) {
                    s = parseInt(p[i].style.fontSize.replace("px", ""));
                } else {
                    s = 12;
                }
                if (s != min) {
                    s -= 1;
                }
                p[i].style.fontSize = s + "px";
            }
        }
        jQuery(document).ready(function () {
            jQuery(".ExpandContent").hide();
            $(".InnerTextSpan").text("+");
            //toggle the componenet with class msg_body
            jQuery(".ExpandHeading").click(function () {
                var t = $(this).children(".InnerTextSpan").text();
                if (t == "-") {
                    $(this).children(".InnerTextSpan").text("+");
                }
                else {
                    $(this).children(".InnerTextSpan").text("-");
                }
                jQuery(this).next(".ExpandContent").slideToggle(500);
            });
        });

        //Search Filter Script
        var selectedTab;
        function OwMouseOverFilterTab(sender, eventArgs)
        {
            var multiPageID = sender.get_multiPageID();
            var tab = eventArgs.get_tab();
            sender.set_multiPageID(multiPageID); tab.select();
            selectedTab = eventArgs.get_tab();
            $('#' + sender.get_multiPageID()).css({ 'position': 'absolute', 'top': eventArgs.get_tab().get_index()*40+'px', 'background-color': '#fff' });
            /*alert(eventArgs.get_tab().get_index());*/
        }

        function selectAllNodes(id)
        {
            var nestedTreeView = $find(id);
            for (var i = 0; i < nestedTreeView.get_allNodes().length; i++)
            {
                nestedTreeView.get_allNodes()[i].check();
            }            
        }
        function deselectAllNodes(id)
        {
            var nestedTreeView = $find(id);
            for (var i = 0; i < nestedTreeView.get_allNodes().length; i++)
            {
                nestedTreeView.get_allNodes()[i].uncheck();
            }            
        }        
    </script>
</owc:OwScriptBlock>
